package com.wu.weiyang.util;

/**
 * className: CreateResponse <br/>
 * author: 50816 <br/>
 * date: 2019/8/18 22:13 <br/>
 * describe: 相应类返回模版
 */
public class CreateResponse {

    public static <T> ResponseTemp<T> create(Integer code, String msg, T data) {
        return new ResponseTemp<T>().setCode(code).setMsg(msg).setData(data);
    }

    public static <T> ResponseTemp<T> success(String msg, T data) {
        return new ResponseTemp<T>().setCode(Constant.SUCCESS_CODE).setMsg(msg).setData(data);
    }

    public static <T> ResponseTemp<T> success(String msg) {
        return new ResponseTemp<T>().setCode(Constant.SUCCESS_CODE).setMsg(msg);
    }

    public static <T> ResponseTemp<T> fail(String msg) {
        return new ResponseTemp<T>().setCode(Constant.FAIL_CODE).setMsg(msg);
    }

    public static <T> ResponseTemp<T> exception() {
        return new ResponseTemp<T>().setCode(Constant.EXCEPTION_CODE).setMsg(Constant.EXCEPTION_MSG);
    }

    public static <T> ResponseTemp<T> unAuth() {
        return new ResponseTemp<T>().setCode(Constant.UNAUTH).setMsg(Constant.UNAUTH_MSG);
    }
}
